using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class TransparentTest : MonoBehaviour {

	public float alpha = 0.5f;
	Color originalColor;
	Material matOriginal;
	public Material matToChange;
	// Use this for initialization
	void Start () {
		matOriginal = gameObject.renderer.material;
		//Debug.Log ("mat color  "+gameObject.renderer.material.color);
		//originalColor = gameObject.renderer.material.color;
		//ResetTrans();
	}

	public void ResetTrans()
	{
		//gameObject.renderer.material.color = originalColor;
		gameObject.renderer.material = matOriginal;
	}

	public void SetTrans()
	{
		gameObject.renderer.material = matToChange;
		gameObject.renderer.material.color = new Color(1,1,1,alpha);
	}
	
	// Update is called once per frame
//	void Update () {
//		gameObject.renderer.material.color = new Color(1,1,1,alpha);
//	}
}
